package com.cat.springbootannocation.controller;

import com.cat.springbootannocation.entity.User;
import com.cat.springbootannocation.mapper.UserMapper;
import com.cat.springbootannocation.service.IUserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:zss
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private IUserService userService;


    @RequestMapping("/getUser")
    public String getUser(Integer id) {
        String userName = userService.getUser(id);
        System.out.println(userName);
        return userName; 
    }
    @RequestMapping("/updateUser")
    public void updateUser(Integer id,String userName){
        User user = new User();
        user.setUserName(userName);
        user.setId(id);

        userMapper.updateUser(user);
    }
    
}
